import axios from '../plugin/axios/axios'

//签到获取预约数据
export const signin = (data) => {
  return axios({
      url: '/api/v1/reservation/current',
      method: 'POST',
      data
  },true)
}
//预约管理获取数据
export const make = (data,user) => {
  return axios({
      url: `/api/v1/dirty/reservation/day?date=${data}&baseId=${user}`,
      method: 'GET',
  },true)
}
//获取基地在指定时间的容量
export const intakecapacity = (data,baseId) => {
  return axios({
      url: `/api/v1/base/available/reservation/${baseId}`,
      method: 'PUT',
      data
  },true)
}
//获取基地概况
export const message = params => {
  return axios({
      url: `/api/v1/dirty/base/summary`,
      method: 'GET',
      params
  },true)
}
//获取概况详细数据
export const messageList = (time) => {
  return axios({
      url: `/api/v1/dirty/reservation/${time}`,
      method: 'GET',
  },true)
}
//代签
export const allograph = (data) => {
  return axios({
      url: `/api/v1/sign_in/proxy`,
      method: 'POST',
      data
  },true)
}
//查看基地二维码
export const Viewqrcode = (basename) => {
  return axios({
      url: `/api/v1/qr/code/${basename}`,
      method: 'GET',
  },true)
}
//下载所有基地二维码
export const downloadallViewqrcode = () => {
  return axios({
      url: `/api/v1/qr/code/bases`,
      method: 'GET',
  },true)
}

//评价管理
export const evaluateAXIOS = (startTime,endTime,baseId,Per_page,Page_no) => {
  return axios({
      url: `/api/v1/dirty/reservation/completed?startTime=${startTime}&endTime=${endTime}&baseId=${baseId}&per_page=${Page_no}&page_no=${Per_page}`,
      method: 'GET',
  },true)
}
//获取指定预约的所有学生对基地评价
export const Seetheevaluation = (reservationId) => {
  return axios({
      url: `/api/v1/dirty/comments/student/base/${reservationId}`,
      method: 'GET',
  },true)
}
//获取指定预约的所有基地管理员的评价
export const Baseadministratorevaluation = (reservationId,baseid) => {
  return axios({
      url: `/api/v1/dirty/comments/base/student/${reservationId}?baseManagerId=${baseid}`,
      method: 'GET',
  },true)
}
//学生提交评论
export const Submitcomments = (id,data) => {
  return axios({
      url: `/api/v1/comments/${id}`,
      method: 'POST',
      data
  },true)
}
//学生对基地管理员的评价(已通过)
export const Evaluationapproved = (user) => {
  return axios({
      url: `/api/v1/dirty/comments/student/base/${user}`,
      method: 'GET',
  },true)
}
//学生对基地管理员的评价(审核中)
// export const underreview = () => {
//   return axios({
//       url: `http://localhost/api/v1/dirty/comments/student/base/201907110938-12-101`,
//       method: 'GET',
//   },true)
// }
//通过审核
export const audit = (id,data) => {
  return axios({
      url: `/api/v1/comments/${id}`,
      method: 'PUT',
      data
  },true)
}
//获取签到签退记录
export const punchingcardrecord = (id,startTime,endTime) => {
  return axios({
      url: `/api/v1/sign_in?baseId=${id}&startTime=${startTime}&endTime=${endTime}`,
      method: 'GET',
  },true)
}
//获取签到签退记录
export const reservationRecord = (BaseId) => {
  return axios({
      url: `/api/v1/7m-24/user/edu/students?baseId=${BaseId}`,
      method: 'GET',
  },true)
}
//获取学校列表
export const schoolList = (baseId,StartTime) => {
  return axios({
      url: `/api/v1/m7-24/schools/comments/curt?baseId=${baseId}${StartTime ? '&date=' + StartTime : ''}`,
      method: 'GET',
  },true)
}
//提交批量评价
export const batchEvaluation = (data) => {
  return axios({
      url: `/api/v1/7m-24/comments/batch/time`,
      method: 'POST',
      data
  },true)
}
//获取基地信息
export const baseInformation = (baseid) => {
  return axios({
      url: `/api/v1/7m-24/bases/${baseid}`,
      method: 'GET',
  },true)
}
export default {
    signin,
    make,
    message,
    intakecapacity,
    allograph,
    messageList,
    Viewqrcode,
    downloadallViewqrcode,
    evaluateAXIOS,
    Seetheevaluation,
    Baseadministratorevaluation,
    Submitcomments,
    Evaluationapproved,
    punchingcardrecord,
    audit,
    schoolList,
    batchEvaluation,
    reservationRecord,
    baseInformation
}